#ifndef CSPINBOX_H_
#define CSPINBOX_H_

#include "cbutton.h"
#include "clabel.h"
#include "ctextlistitem.h"
#include "../event/ckeyidentifications.h"
#include "../event/cmouseclickevent.h"
#include "../event/cmousemoveevent.h"

/**
 * CSpinBox - class representing adjustable selection list
 * @author Michal Rost
 * @date 27.06.2008
 */
class CSpinBox : public CDynamicGuiObject {
public:
  CSpinBox(vector<CTextListItem> spinItems);
  CSpinBox(vector<string> spinItems);
  CSpinBox(vector<string> spinItems, vector<int> spinItemIds);
  ~CSpinBox();
  vector<CTextListItem>::iterator getSelection() const;
  CButton* getButtonUpPtr() const;
  CButton* getButtonDownPtr() const;
  void setSpinItems(vector<CTextListItem> spinItems);
  void setSpinItems(vector<string> spinItems);
  void setSpinItems(vector<string> spinItems, vector<int> spinItemIds);
  static string getClassName() {
    return "CSpinBox";
  }
protected:
  CLabel* label;
  CButton* buttonUp;
  CButton* buttonDown;
  vector<CTextListItem> spinItems;
  vector<CTextListItem>::iterator sel;
  void free();
  void init();
  void onAdd();
  bool isFocused(CMouseEvent* eventPtr);
  void keyDown(unsigned short keyId, unsigned short unicode);
  void moveSelectionUp();
  void moveSelectionDown();
  void drawSelf(CGuiRenderer* rendererPtr) {
  }
  bool isOverlap(CRect<int> &rect) {
    return false;
  }
};

#endif
